package play.`class`

class Properties {
    var name: String = "Holmes, Sherlock"
    private var street: String = "Baker"
    private var city: String = "London"
    private var state: String? = null
    private var zip: String = "123456"

    val address: String
        get() = "${state ?: ""} $city $street $zip"
    val isEmpty: Boolean
        get() = this.name.isEmpty()

    var age: Int = 0
        get() = if (field <= 0) 18 else field
        set(value) {
            field = if (value <= 0) 20 else value
        }
}

fun main() {
    val properties = Properties()
    println(properties.age)
    properties.age = 10
    println(properties.age)
    println(properties.isEmpty)
    println(properties.address)
}